import sys

import requests

from api.base import Login


class merProductClassify(Login):
    # 新增商品分类
    def store_product_category_add(self, name, sort=1):
        data = {
            'url': '/api/admin/merchant/store/product/category/add',
            'method': 'post',
            'headers': {'Authori-zation': self._mer_token},
            'json': {
                'icon': 'https://crmebjavamer.oss-cn-beijing.aliyuncs.com/crmebimage/public/store/2024/08/09/329e096ada794a27993d7c1a9b3e6dfe1izzcb4g22.png',
                'name': name,
                'pid': 859,
                'sort': sort,
                'id': 0,
            }
        }
        return self.mer_send_request(sys._getframe().f_code.co_name,data)

    # 删除分类
    def store_product_category_delete(self, pid):
        data = {
            'url': f'/api/admin/merchant/store/product/category/delete/{pid}',
            'method': 'post',
            'headers': {'Authori-zation': self._mer_token},
        }
        return self.mer_send_request(sys._getframe().f_code.co_name,data)
